<template>
  <PickView @handleBack="handleBack" @handleUpload="handleUpload" />
</template>
<script lang="ts">
import { MAP } from '@/router/route-name';
import {
  useLocationMainStore,
  useLoginInforStore,
  usePickStore,
} from '@/store';
import { computed, defineComponent } from 'vue';
import { useRouter } from 'vue-router';
import PickView from './PickView.vue';
export default defineComponent({
  components: { PickView },
  setup() {
    const router = useRouter();
    const location = useLocationMainStore();
    const infor = useLoginInforStore();
    const { queryUpload, getAllImage } = usePickStore();
    const handleBack = () => {
      router.push({ name: MAP });
    };

    const lng = computed(() => location.lng);
    const lat = computed(() => location.lat);
    const userinfor = computed(() => infor.userInfo);

    const handleUpload = async (value: string) => {
      await location.getLoaction();
      await queryUpload(lng.value, lat.value, value, userinfor.value.id);
    };
    return { handleBack, handleUpload };
  },
});
</script>
<style lang="less" scoped></style>
